<style>
.label-default {
    background-color: #f5f7fb;
	color: #999;
}
</style>
<div class="fui-page" ng-if="pagedata.op == 'list'">
	<div id="tab" class="fui-tab fui-tab-danger" style="top:0">
        <a class="external {{pagedata.params.status == 0?'active':''}}" href="javascript:" ng-click="pagedata.params.status=0;tool.get_list('jy_aihire/merch.zhao/list/',true)">待上架</a>
        <a class="external {{pagedata.params.status == 1?'active':''}}" href="javascript:" ng-click="pagedata.params.status=1;tool.get_list('jy_aihire/merch.zhao/list/',true)">已上架</a>
    </div>
	<div class='fui-content'>
	<div class='jy-content'>
	<div class="fui-cell-group radius" ng-repeat="item in pagedata.list">
		<div class="fui-cell" style="background:#fff;padding:0.5rem;align-items:stretch" href="javascript:;" ng-click="access_json('jy_aihire/merch.zhao/edit/id='+item.id)">
				<div class="fui-cell-text" style="line-height:1.8">
					<div>{{item.title}}</div>
					<div>
						<span class="label label-default">{{item.onlinetime.start}}~{{item.onlinetime.end}}</span>
						<span class="label label-default">{{item.baotypetitle}}</span>
					</div>
				</div>
				<div class="fui-cellone-remark noremark">
					<span class="bold syscolor" style="font-size:0.9rem">{{item.pay}}</span>
				 </div>
		</div>
		<div class="r" style="padding:0.5rem">
			<span class="btn btn-sm btn-default-o order-finish" href="javascript:" ng-click="access_json('/merch.zhao/edit/id='+item.id)">编辑</span>
        </div>
	</div>
	</div>
	<div class="content-empty" ng-show="!pagedata.list || pagedata.list.length == 0 ">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您暂时没有任务！</p>
	</div>
	<div ng-include="sys_html('common/_copyright',true)"></div>
	</div>
</div>
<div class="fui-page" ng-if="pagedata.op == 'edit'">
	<div class='fui-content'>
		<div class="topbg" style="position: relative;width:100%;background: {{main.syscolor || '#7c1cc9'}};height:3.3rem">
			<div class="fui-cell-title bold" style="padding-top:0.8rem;color:#fff">编辑任务</div>
		</div>
		<div class="jy-content" style="margin-top:-1.5rem">
		<div class="fui-cell-group">
			<div class="fui-cell">
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入任务名称" ng-model="pagedata.item.title" /></div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:auto">任务岗位</div>
				<div class="fui-cell-info" style="padding-right:0.5rem">
					<select ng-model="pagedata.item.pid">
							<option value="" selected="selected">一级分类</option>
							<option ng-repeat="(value,data) in pagedata.pids" value="{{data.id}}" ng-selected="pagedata.item.pid==data.id">{{data.title}}</option>
					</select>
				</div>
				<div class="fui-cell-info">
							<select ng-model="pagedata.item.cid">
							<option value="" selected="selected">二级分类</option>
							<option ng-repeat="(value,data) in pagedata.pids[pagedata.item.pid].cids" value="{{data.id}}" ng-selected="pagedata.item.cid==data.id">{{data.title}}</option>
							</select>			
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:auto">性别要求</div>
				<div class="fui-cell-info">
				<select ng-model="pagedata.item.sex">
					<option value="" selected="selected">请选择</option>
					<option ng-repeat="(value,data) in pagedata.sex" value="{{value}}" ng-selected="pagedata.item.sex==value">{{data}}</option>
				</select>
				</div>
			</div>
			<div class="fui-cell">
					<div class="fui-cell-label ">任务详情</div>
					<div class="fui-cell-info">
						<textarea rows="6" placeholder="请输入任务详情" ng-model="pagedata.item.remark" id="title"></textarea>
					</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:auto">任务类型</div>
				<div class="fui-cell-info">
				<select ng-model="pagedata.item.type">
					<option value="" selected="selected">请选择</option>
					<option ng-repeat="(value,data) in pagedata.job_type" value="{{value}}" ng-selected="pagedata.item.type==value">{{data}}</option>
				</select>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:auto">薪资类型</div>
				<div class="fui-cell-info" style="padding-right:0.2rem">
				<select ng-model="pagedata.item.paytype">
					<option value="" selected="selected">请选择</option>
					<option ng-repeat="(value,data) in pagedata.job_paytype" value="{{value}}" ng-selected="pagedata.item.paytype==value">{{data}}</option>
				</select>
				</div>
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入薪资" ng-model="pagedata.item.price" /></div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:auto">上班时间</div>
				<div class="fui-cell-info" style="padding-right:0.2rem">
				<select ng-model="pagedata.item.onlinetime.start">
					<option value="" selected="selected">请选择</option>
					<option ng-repeat="(value,data) in pagedata.time_hour" value="{{data}}" ng-selected="pagedata.item.onlinetime.start==data">{{data}}</option>
				</select>
				</div>
				<div class="fui-cell-info">
				<select ng-model="pagedata.item.onlinetime.end">
					<option value="" selected="selected">请选择</option>
					<option ng-repeat="(value,data) in pagedata.time_hour" value="{{data}}" ng-selected="pagedata.item.onlinetime.end==data">{{data}}</option>
				</select>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:auto">保险类型</div>
				<div class="fui-cell-info">
				<select ng-model="pagedata.item.baotype">
					<option value="" selected="selected">请选择</option>
					<option ng-repeat="(value,data) in pagedata.job_baotype" value="{{value}}" ng-selected="pagedata.item.baotype==value">{{data}}</option>
				</select>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:4.2rem">工作地</div>		
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.province">
								<option value="" selected="selected">省份</option>
								<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.item.pcd.province==value">{{value}}</option>
								</select>
							</div>
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.city">
								<option value="" selected="selected">城市</option>
								<option ng-repeat="(value,data) in pagedata.province[pagedata.item.pcd.province]" value="{{value}}" ng-selected="pagedata.item.pcd.city==value">{{value}}</option>
								</select>
							</div>
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.district">
								<option value="" selected="selected">区县</option>
								<option ng-repeat="(value,data) in pagedata.province[pagedata.item.pcd.province][pagedata.item.pcd.city]" value="{{value}}" ng-selected="pagedata.item.pcd.district==value">{{value}}</option>
								</select>
							</div>
							<div class="fui-cell-label" style="width:28%">
								<select ng-model="pagedata.item.pcd.street">
								<option value="" selected="selected">街道</option>
								<option ng-repeat="value in pagedata.province[pagedata.item.pcd.province][pagedata.item.pcd.city][pagedata.item.pcd.district]" value="{{value}}" ng-selected="pagedata.item.pcd.street==value">{{value}}</option>
								</select>
							</div>
				
			</div>
			<div class="fui-cell">
				<div class="fui-cell-info"><input type="text" class='fui-input' placeholder="请输入详细地址" ng-model="pagedata.item.address" /></div>
			</div>
			 <div class="fui-cell">
				 <div class="fui-cell-info">
					<input type="text" ng-model="pagedata.item.lat_lng.lng" placeholder="经度"  class="form-control"/>
				 </div>
				 <div class="fui-cell-info" style="margin-left:0.5rem">
					<input type="text" ng-model="pagedata.item.lat_lng.lat" placeholder="纬度"  class="form-control"/>
				 </div>
				 <div class="fui-cell-remark noremark" style="margin-left:0.5rem">
					<a ng-click="tool.choose_location(pagedata.item,'lat_lng')" class="btn btn-default btn-default-o btn-sm" type="button">选择坐标</a>
				 </div>
			</div>
			<div class="fui-cell">
                <div class="fui-cell-label">任务多图</div>
                <div class="fui-cell-info">
					<div class="weui_uploader">
                        <div class="weui_uploader_bd" style="margin-bottom:0">
                            <ul class="weui_uploader_files">
                                <li ng-repeat="p in pagedata.item.images" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')">
									<div class="upbtn" >
										<a style="color:#f60" href="javascript:;" ng-click="pagedata.item.images.splice($index-1,0,p);pagedata.item.images.splice($index+1,1)">上移</a>
										<a style="color:#f60" href="javascript:;" ng-click="pagedata.item.images.splice($index,1)">删除</a>
									</div>
								</li>
                            </ul>
                            <div class="weui_uploader_input_wrp" href="javascript:;" ng-click="images(pagedata.item,'images')"></div>
                        </div>
                    </div>
				</div>
            </div>
			<div class="fui-cell">
				<div class="fui-cell-label" style="width:2rem">状态</div>
				<div class="fui-cell-info" ng-click="toogle(pagedata.item,'status',[0,1])">
					<input class="weui_switch" type="checkbox" ng-checked="pagedata.item.status==1">
				</div>
			</div>
		</div>
		<a href='javascript:;' ng-click="post(pagedata.item,'/merch.zhao/post/')" class='btn btn-success block'>确认提交</a>
	</div>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
if(scope.pagedata.op == 'list'){
	scope.tool.get_list('jy_aihire/merch.zhao/list/',true);
	scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('jy_aihire/merch.zhao/list/');
	}
}else{
	scope.pagedata.getprovince=function(){
	scope.get('core/member.set/getprovince/',function(res){
		scope.pagedata.province=res.province;
		scope.$evalAsync();
	});
	}
	scope.pagedata.getprovince();
}
</script>